package com.lzx.iteam.data;

import com.lzx.iteam.bean.CRMFilterFirstData;
import com.lzx.iteam.bean.CRMFilterSecondData;
import com.lzx.iteam.bean.CRMOrderByData;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by Megan on 16/8/9.
 */
public class CRMOrderFilterSource {


    public CRMOrderFilterSource() {
    }

    /**
     * @param type 0:公海,或销售线索,无法进行所属人筛选的   1:销售线索可进行所属人筛选的
     * @return
     */
    public ArrayList<CRMFilterFirstData> getPublicClueFilterData(int type) {
        ArrayList<CRMFilterFirstData> firstDatas = new ArrayList<CRMFilterFirstData>();
        String[] first = null;
        if (type == 0) {
            first = new String[]{"线索来源", "跟进状态", "活动记录", "修改日期", "创建日期"};
        } else if (type == 1) {
            first = new String[]{"线索来源", "跟进状态", "活动记录", "修改日期", "创建日期", "所属人"};
        }
        HashMap<String, String[]> second = new HashMap<String, String[]>();
        second.put(first[0], new String[]{"不限", "广告", "研讨会", "搜索引擎", "客户介绍", "其他"});
        second.put(first[1], new String[]{"不限", "未处理", "已联系", "已关闭"});
        second.put(first[2], new String[]{"不限", "最近7天", "最近1个月", "最近3个月", "最近1年"});
        second.put(first[3], new String[]{"不限", "最近7天", "最近1个月", "最近3个月", "最近1年"});
        second.put(first[4], new String[]{"不限", "最近7天", "最近1个月", "最近3个月", "最近1年"});
        if (type == 1) {
            second.put(first[5], new String[]{""});
        }
        for (int i = 0; i < first.length; i++) {
            CRMFilterFirstData firstData = new CRMFilterFirstData();
            firstData.setName(first[i]);
            firstData.setId(i + "");
            ArrayList<CRMFilterSecondData> secondDatas = new ArrayList<CRMFilterSecondData>();
            for (int j = 0; j < second.get(first[i]).length; j++) {
                CRMFilterSecondData secondData = new CRMFilterSecondData();
                secondData.setName(second.get(first[i])[j]);
                secondData.setId((j - 1) + "");
                if (i == 0 || i == 1 || i == 5) {
                    firstData.setType(1);
                    secondData.setType(1);
                } else {
                    firstData.setType(0);
                    secondData.setType(0);
                }
                if (j == 0) {
                    secondData.setState(1);
                } else {
                    secondData.setState(0);
                }
                secondDatas.add(secondData);
            }
            firstData.setSecondDatas(secondDatas);
            firstDatas.add(firstData);
        }
        return firstDatas;
    }

    public ArrayList<CRMOrderByData> getPublicClueOrderData() {
        ArrayList<CRMOrderByData> orderByDatas = new ArrayList<CRMOrderByData>();
        CRMOrderByData crmOrderByData1 = new CRMOrderByData();
        crmOrderByData1.setName("创建时间");
        orderByDatas.add(crmOrderByData1);
        CRMOrderByData crmOrderByData2 = new CRMOrderByData();
        crmOrderByData2.setName("活动时间");
        orderByDatas.add(crmOrderByData2);
        return orderByDatas;
    }

    public ArrayList<CRMFilterFirstData> getChanceFilterData() {
        ArrayList<CRMFilterFirstData> firstDatas = new ArrayList<CRMFilterFirstData>();

        String[] first = {"销售金额", "销售阶段", "结单日期"};
        HashMap<String, String[]> second = new HashMap<String, String[]>();
        second.put(first[0], new String[]{"不限", "千", "万", "十万", "百万", "千万"});
        second.put(first[1], new String[]{"不限", "初步接洽", "需求确定", "方案报价", "谈判审核", "赢单", "输单"});
        second.put(first[2], new String[]{"不限", "本周", "本月", "本季度", "本年", "本日", "下周", "下月"});
        for (int i = 0; i < first.length; i++) {
            CRMFilterFirstData firstData = new CRMFilterFirstData();
            firstData.setName(first[i]);
            firstData.setId(i + "");
            ArrayList<CRMFilterSecondData> secondDatas = new ArrayList<CRMFilterSecondData>();
            for (int j = 0; j < second.get(first[i]).length; j++) {
                CRMFilterSecondData secondData = new CRMFilterSecondData();
                secondData.setName(second.get(first[i])[j]);
                secondData.setId((j - 1) + "");
                if (i == 1) {
                    firstData.setType(1);
                    secondData.setType(1);
                } else {
                    firstData.setType(0);
                    secondData.setType(0);
                }
                if (j == 0) {
                    secondData.setState(1);
                } else {
                    secondData.setState(0);
                }
                secondDatas.add(secondData);
            }
            firstData.setSecondDatas(secondDatas);
            firstDatas.add(firstData);

        }
        return firstDatas;
    }

    public ArrayList<CRMOrderByData> getChanceOrderData() {
        ArrayList<CRMOrderByData> orderByDatas = new ArrayList<CRMOrderByData>();
        CRMOrderByData crmOrderByData1 = new CRMOrderByData();
        crmOrderByData1.setName("销售阶段");
        orderByDatas.add(crmOrderByData1);
        CRMOrderByData crmOrderByData2 = new CRMOrderByData();
        crmOrderByData2.setName("最高销售额");
        orderByDatas.add(crmOrderByData2);
        CRMOrderByData crmOrderByData3 = new CRMOrderByData();
        crmOrderByData3.setName("活动记录");
        orderByDatas.add(crmOrderByData3);
        CRMOrderByData crmOrderByData4 = new CRMOrderByData();
        crmOrderByData4.setName("升迁时间");
        orderByDatas.add(crmOrderByData4);
        return orderByDatas;
    }

    public ArrayList<CRMOrderByData> getClientOrderData() {
        ArrayList<CRMOrderByData> orderByDatas = new ArrayList<CRMOrderByData>();
        CRMOrderByData crmOrderByData1 = new CRMOrderByData();
        crmOrderByData1.setName("最新创建");
        orderByDatas.add(crmOrderByData1);
        CRMOrderByData crmOrderByData2 = new CRMOrderByData();
        crmOrderByData2.setName("最新活动");
        orderByDatas.add(crmOrderByData2);
        return orderByDatas;
    }

    public ArrayList<CRMFilterFirstData> getClientFilterData() {
        ArrayList<CRMFilterFirstData> firstDatas = new ArrayList<CRMFilterFirstData>();
        String[] first = {"客户所有人", "客户级别", "行业", "企业总人数", "最新活动时间"};
        HashMap<String, String[]> second = new HashMap<String, String[]>();
        second.put(first[0], new String[]{"不限",});
        second.put(first[1], new String[]{"不限", "重点", "普通", "非优先"});
        second.put(first[2], new String[]{"不限", "金融", "政府", "咨询", "娱乐", "媒体", "零售", "能源", "服务", "制造业", "高科技", "教育", "电信", "公用事业", "非盈利事业", "其他"});
        second.put(first[3], new String[]{"不限", "20人以下", "20-99人", "100-499人", "500-999人", "1000人以上"});
        second.put(first[4], new String[]{"不限", "1周内", "1个月内", "3个月内", "1年内"});
        for (int i = 0; i < first.length; i++) {
            CRMFilterFirstData firstData = new CRMFilterFirstData();
            firstData.setName(first[i]);
            firstData.setId(i + "");
            ArrayList<CRMFilterSecondData> secondDatas = new ArrayList<CRMFilterSecondData>();
            for (int j = 0; j < second.get(first[i]).length; j++) {
                CRMFilterSecondData secondData = new CRMFilterSecondData();
                secondData.setName(second.get(first[i])[j]);
                secondData.setId((j - 1) + "");
                if (i == 2) {
                    firstData.setType(1);
                    secondData.setType(1);
                } else {
                    firstData.setType(0);
                    secondData.setType(0);
                }
                if (j == 0) {
                    secondData.setState(1);
                } else {
                    secondData.setState(0);
                }
                secondDatas.add(secondData);
            }
            firstData.setSecondDatas(secondDatas);
            firstDatas.add(firstData);
        }
        return firstDatas;
    }


}
